home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-0497 / AMOSLIST / text0139.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  1.3 KB  |  46 lines

  1. Hi Mush,
  2.  
  3. > >> OK, ill try and explain this problem again. Im making a perspective
  4. > >> box/rectangle, so naturally, one end will be close, and the other end
  5. > >> smaller, so simulate the depth of the box. Here is an example: (crap
  6. > ASCII art)
  7. > I know the top coords of the 2 lines drawn, but it is the top and bottom Y
  8. > coordinates on the actual SLOPES that I need to know quickly
  9.  
  10. It sounds like you are already using run length slicing.
  11. This is just about the fastest way of drawing a line IF you are coding in
  12. assembly.
  13.  
  14. You could speed up the inner loop by checking for the gradient before you
  15. start the loop and branching to four seperate routines depending on the
  16. gradient.
  17.  
  18.  
  19.     /<--45%
  20. |1 /
  21. | / 2    
  22. |/____
  23. |\  
  24. | \ 3
  25. |4 \
  26.  
  27. You probably know that already, can you be a little more specific about
  28. what you need? what are you actually doing with the result, and how is this
  29. function to be called? do you calc every value from left to right? do you
  30. need multiple y values for a single x in quadrants 1 and 4.
  31.  
  32. I guess you use 'If' to avoid a divide?
  33.  
  34. Division is slow. The bitwise Ror is a faster way to divde by 2. that would
  35. at least give you the centre of the line, I think AMOSPro auto converts
  36. those divisions, but the point is to divide by 2 or 4, not 5...
  37.  
  38. Hope this helps...
  39.  
  40. -- 
  41. Adam.
  42.  
  43.  
  44.  
  45.